home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CU Amiga Super CD-ROM 19
/
CU Amiga Magazine's Super CD-ROM 19 (1998)(EMAP Images)(GB)[!][issue 1998-02].iso
/
CUCD
/
Online
/
Apache
/
wwwcount2.4
/
Count-install
< prev
next >
Wrap
Text File
|
1997-12-10
|
13KB
|
493 lines
#!/bin/sh
##
# $Revision: 2.4 $
# $Date: 09/12/1997/ 22:50:45 $
#
# creates the directories related to Count 2.1 and install the binary
# Count.cgi to the cgi-bin directory, copy the digit directories to
# the digit directory
# this program uses the variable template created by the Count_config
# program
#
# muquit@semcor.com
# Nov 24, 1995
#
# added F digits and utilities install by Bert Vortman for Amiga Apache.
##
ver=`cat ./VERSION`
Basedir="wwwcount$ver"
INSTALL_PROG="./install-sh"
Tmpl="./Config.tmpl"
Binary="./src/Count.cgi"
DigitA="./wcount/digits/A"
DigitB="./wcount/digits/B"
DigitC="./wcount/digits/C"
DigitD="./wcount/digits/D"
DigitE="./wcount/digits/E"
DigitF="./wcount/digits/F"
Utils="./wcount/utils"
Rgbfile="./wcount/rgb.txt"
SAMPLE_DAT="./wcount/data/sample.dat"
UserId="nobody"
userid_flag=0
GroupId="nobody"
groupid_flag=0
Digits="zero.gif one.gif two.gif three.gif four.gif five.gif\
six.gif seven.gif eight.gif nine.gif"
Pwd=`pwd`
checkbd=`basename $Pwd`
###
# check if we'r inside wwwcount2.2 directory
if [ $checkbd != $Basedir ]
then
cat << EOR2
************************************************************************
You must be at the base directory of the counter source distribution
in order to install Count.cgi
Wrong directory: $checkbd
************************************************************************
EOR2
exit 2
fi
if [ ! -f $Tmpl ]
then
cat<<EOT
The varaible template file "$Tmpl" does not exist! This file
is created in the configuration procedure. Apparently your
configuration procedure did not succeed!
Aborting installation!
EOT
exit 1
fi
if [ ! -f $Binary ]
then
cat<<EOB
Counter binary "$Binary" does not exist!
Apparently your compilation did not succeed or you did not compile
the program!
Aborting installation!
EOB
exit 1
fi
if [ ! -d $DigitA -o ! -d $DigitB -o ! -d $DigitC -o ! -d $DigitD ]
then
cat<<EOD
Suppiled digit directories not found in ./digits direcory!
Aborting installation!
EOD
exit 1
fi
if [ ! -f $Rgbfile ]
then
cat<<EOB
Rgb file "$Rgbfile" does not exist!
Apparently your removed it mistakenly!
Aborting installation!
EOB
exit 1
fi
##
# get the vars
##
. $Tmpl
if [ ! -f ./$CONFIG_FILE ]
then
cat <<EOC
The configuration file $CONFIG_FILR is not created!
please create it first by running the script ./Gen-conf
Aborting installation!
EOC
exit 1
fi
# check if root
uidfile="/tmp/Count$$"
touch $uidfile
user=`ls -al $uidfile | awk '{print $3}'`
if [ "$user" != "root" ]
then
cat << EOR
WARNING: You are not root! To install the package in the system,
you will need root access!
EOR
else
cat <<EOJ
*** You are installing Counter as root ***
EOJ
rm -f $uidfile
fi
# if [ "`whoami`x" != "root"x ]; then
#cat << EOR
# WARNING: You are not root! To install the package in the system,
# you will need root access!
#EOR
# else
#cat <<EOJ
# *** You are installing Counter as root ***
#EOJ
# fi
(echo "hi there\c" ; echo " ") >./.echotest
if grep c ./.echotest >/dev/null 2>&1 ; then
n='-n'
c=''
else
n=''
c='\c'
fi
rm -f ./.echotest >/dev/null 2>&1
# debug
cat<<DUM
===================
Your configuration:
cgi-bin directory= $CGIBIN_DIR
conf directory= $CONFIG_DIR
conf file= $CONFIG_FILE
digit directory=$DIGIT_DIR
data directory=$DATA_DIR
log directory=$LOG_DIR
log file=$LOG_FILE
rgb file= $RGB_FILE
util directory=$UTIL_DIR
===================
DUM
echo $n "Continue [y|n]$c? "
read answer
if [ .$answer = . ]
then
answer=x
fi
until [ $answer = "y" -o $answer = "Y" -o $answer = "n" -o $answer = "N" ]
do
echo $n "Continue [y|n]$c? "
read answer
if [ .$answer = . ]
then
answer=x
fi
done
case $answer in
y|Y)
echo "proceeding..."
;;
n|N)
echo "Exiting..Better luck next time!"
exit 1
;;
*)
echo ""
echo "Illegal choice"
esac
cat <<EOU
Now if you know what user and group id child processes of http
server use, I can change the ownership and access permission
accordigly. If you do not know, they are usually defined in the
file httpd.conf with User and Group. I suggest create a unique
user and group say httpd and set the User and Group to httpd.
EOU
echo $n "*Do you know the user and group id of httpd' child process [y|n]:$c? "
read answer
if [ .$answer = . ]
then
answer=x
fi
until [ $answer = "y" -o $answer = "Y" -o $answer = "n" -o $answer = "N" ]
do
echo $n "*Do you know the user and group id of httpd' child process [y|n]:$c? "
read answer
if [ .$answer = . ]
then
answer=x
fi
done
case $answer in
y|Y)
userid_flag=1
groupid_flag=1
###
# enter user id -starts
###
echo $n "*Enter user id of httpd's child process [no default]:$c? "
read answer
if [ .$answer = . ]
then
answer=x
fi
until [ $answer != "x" ]
do
echo $n "*Enter user id of httpd's child process [no default]:$c? "
read answer
if [ .$answer = . ]
then
answer=x
fi
done
UserId=$answer
###
# enter user id -ends
###
##
# enter groud id -starts
##
echo $n "*Enter group id of httpd's child process [no default]:$c? "
read answer
if [ .$answer = . ]
then
answer=x
fi
until [ $answer != "x" ]
do
echo $n "*Enter group id of httpd's child process [no default]:$c? "
read answer
if [ .$answer = . ]
then
answer=x
fi
done
GroupId=$answer
##
# enter groud id -ends
##
echo "installing Count.cgi->$CGIBIN_DIR"
$INSTALL_PROG -c -o $UserId -g $GroupId -m 700 $Binary $CGIBIN_DIR/Count.cgi
echo "installing $CONFIG_FILE->$CONFIG_DIR"
#
# check if the file exist or not
#
if [ ! -f $CONFIG_DIR/$CONFIG_FILE ]; then
$INSTALL_PROG -c -o $UserId -g $GroupId -m 664 $CONFIG_FILE $CONFIG_DIR/$CONFIG_FILE
else
echo " ===> skipping... Will not overwrite $CONFIG_DIR/$CONFIG_FILE"
echo
fi
echo "installing sample datafile $SAMPLE_DAT->$DATA_DIR"
if [ ! -f $DATA_DIR/sample.dat ]; then
$INSTALL_PROG -c -o $UserId -g $GroupId -m 664 $SAMPLE_DAT $DATA_DIR/sample.dat
chmod 775 $DATA_DIR
else
echo " ===> skipping... Will not overwrite $DATA_DIR/sample.dat"
echo
fi
echo "installing rgb.txt->$BASE_DIR"
$INSTALL_PROG -c -o $UserId -g $GroupId -m 644 $Rgbfile $BASE_DIR/rgb.txt
echo "creating Log directory $LOG_DIR"
./mkdirhier $LOG_DIR
chown $UserId $LOG_DIR
chgrp $GroupId $LOG_DIR
chmod 775 $LOG_DIR
echo "creating utils directory $UTIL_DIR"
./mkdirhier $UTIL_DIR
chown $UserId $UTIL_DIR
chgrp $GroupId $UTIL_DIR
chmod 775 $UTIL_DIR
echo "installing utilities in $UTIL_DIR"
$INSTALL_PROG -c -o $UserId -g $GroupId -m 644 $Utils/extdgts\
$UTIL_DIR/extdgts
$INSTALL_PROG -c -o $UserId -g $GroupId -m 644 $Utils/extdgts.txt\
$UTIL_DIR/extdgts.txt
$INSTALL_PROG -c -o $UserId -g $GroupId -m 644 $Utils/mkstrip\
$UTIL_DIR/mkstrip
$INSTALL_PROG -c -o $UserId -g $GroupId -m 644 $Utils/mkstrip.1\
$UTIL_DIR/mkstrip.1
$INSTALL_PROG -c -o $UserId -g $GroupId -m 644 $Utils/mkstrip.sh\
$UTIL_DIR/mkstrip.sh
$INSTALL_PROG -c -o $UserId -g $GroupId -m 644 $Utils/mkstrip.readme\
$UTIL_DIR/mkstrip.readme
$INSTALL_PROG -c -o $UserId -g $GroupId -m 644 $Utils/mkstrip.txt\
$UTIL_DIR/mkstrip.txt
$INSTALL_PROG -c -o $UserId -g $GroupId -m 644 $Utils/README\
$UTIL_DIR/README
echo "installing image strip for digit style A->$DIGIT_DIR/A"
$INSTALL_PROG -c -o $UserId -g $GroupId -m 644 $DigitA/strip.gif\
$DIGIT_DIR/A/strip.gif
echo "installing image strip for digit style B->$DIGIT_DIR/B"
$INSTALL_PROG -c -o $UserId -g $GroupId -m 644 $DigitB/strip.gif\
$DIGIT_DIR/B/strip.gif
echo "installing strip image for digit style C->$DIGIT_DIR/C"
$INSTALL_PROG -c -o $UserId -g $GroupId -m 644 $DigitC/strip.gif\
$DIGIT_DIR/C/strip.gif
echo "installing strip image for digit style D->$DIGIT_DIR/D"
$INSTALL_PROG -c -o $UserId -g $GroupId -m 644 $DigitD/strip.gif\
$DIGIT_DIR/D/strip.gif
echo "installing sample image lenna.gif->$DIGIT_DIR/D"
$INSTALL_PROG -c -o $UserId -g $GroupId -m 644 $DigitD/lenna.gif\
$DIGIT_DIR/D/lenna.gif
echo "installing strip image for digit style E->$DIGIT_DIR/E"
$INSTALL_PROG -c -o $UserId -g $GroupId -m 644 $DigitE/strip.gif\
$DIGIT_DIR/E/strip.gif
echo "installing strip image for digit style F->$DIGIT_DIR/F"
$INSTALL_PROG -c -o $UserId -g $GroupId -m 644 $DigitF/strip.gif\
$DIGIT_DIR/F/strip.gif
$INSTALL_PROG -c -o $UserId -g $GroupId -m 644 $DigitF/0.gif\
$DIGIT_DIR/F/0.gif
$INSTALL_PROG -c -o $UserId -g $GroupId -m 644 $DigitF/1.gif\
$DIGIT_DIR/F/1.gif
$INSTALL_PROG -c -o $UserId -g $GroupId -m 644 $DigitF/2.gif\
$DIGIT_DIR/F/2.gif
$INSTALL_PROG -c -o $UserId -g $GroupId -m 644 $DigitF/3.gif\
$DIGIT_DIR/F/3.gif
$INSTALL_PROG -c -o $UserId -g $GroupId -m 644 $DigitF/4.gif\
$DIGIT_DIR/F/4.gif
$INSTALL_PROG -c -o $UserId -g $GroupId -m 644 $DigitF/5.gif\
$DIGIT_DIR/F/5.gif
$INSTALL_PROG -c -o $UserId -g $GroupId -m 644 $DigitF/6.gif\
$DIGIT_DIR/F/6.gif
$INSTALL_PROG -c -o $UserId -g $GroupId -m 644 $DigitF/7.gif\
$DIGIT_DIR/F/7.gif
$INSTALL_PROG -c -o $UserId -g $GroupId -m 644 $DigitF/8.gif\
$DIGIT_DIR/F/8.gif
$INSTALL_PROG -c -o $UserId -g $GroupId -m 644 $DigitF/9.gif\
$DIGIT_DIR/F/9.gif
$INSTALL_PROG -c -o $UserId -g $GroupId -m 644 $DigitF/10.gif\
$DIGIT_DIR/F/10.gif
$INSTALL_PROG -c -o $UserId -g $GroupId -m 644 $DigitF/11.gif\
$DIGIT_DIR/F/11.gif
$INSTALL_PROG -c -o $UserId -g $GroupId -m 644 $DigitF/12.gif\
$DIGIT_DIR/F/12.gif
$INSTALL_PROG -c -o $UserId -g $GroupId -m 644 $DigitF/13.gif\
$DIGIT_DIR/F/13.gif
$INSTALL_PROG -c -o $UserId -g $GroupId -m 644 $DigitF/14.gif\
$DIGIT_DIR/F/14.gif
##
# change ownership
# -R is not portable, reported by Geoff Scully <gws@dis.on.ca> and suggested
# the alternative (01/15/96)
#chown -R $UserId.$GroupId $BASE_DIR
find $BASE_DIR -exec chown $UserId {} \;
find $BASE_DIR -exec chgrp $GroupId {} \;
# echo "UserId=$UserId"
# echo "GroupId=$GroupId"
;;
n|N)
cat <<EOM
I am not changing any ownership or access permissions.
You are on your own. If the counter program can not access digit
images or can not write to datafile, you have to set permisson
manually.
good luck!
EOM
echo "installing Count.cgi->$CGIBIN_DIR"
$INSTALL_PROG -c -m 755 $Binary $CGIBIN_DIR/Count.cgi
echo "installing $CONFIG_FILE->$CONFIG_DIR"
$INSTALL_PROG -c $CONFIG_FILE $CONFIG_DIR/$CONFIG_FILE
echo "installing sample datafile $SAMPLE_DAT->$DATA_DIR"
$INSTALL_PROG -c $SAMPLE_DAT $DATA_DIR/sample.dat
echo "installing rgb.txt->$BASE_DIR"
$INSTALL_PROG -c $Rgbfile $BASE_DIR/rgb.txt
echo "creating Log directory $LOG_DIR"
./mkdirhier $LOG_DIR
echo "installing image strip for digit style A->$DIGIT_DIR/A"
$INSTALL_PROG -c $DigitA/strip.gif $DIGIT_DIR/A/strip.gif
echo "installing image strip for digit style B->$DIGIT_DIR/B"
$INSTALL_PROG -c $DigitB/strip.gif $DIGIT_DIR/B/strip.gif
echo "installing image strip for digit style C->$DIGIT_DIR/C"
$INSTALL_PROG -c $DigitC/strip.gif $DIGIT_DIR/C/strip.gif
echo "installing image strip for digit style D->$DIGIT_DIR/D"
$INSTALL_PROG -c $DigitD/strip.gif $DIGIT_DIR/D/strip.gif
echo "installing sample image lenna.gif->$DIGIT_DIR/D"
$INSTALL_PROG -c $DigitD/lenna.gif $DIGIT_DIR/D/lenna.gif
echo "installing image strip for digit style E->$DIGIT_DIR/E"
$INSTALL_PROG -c $DigitE/strip.gif $DIGIT_DIR/E/strip.gif
echo "installing image strip for digit style F->$DIGIT_DIR/F"
$INSTALL_PROG -c $DigitE/strip.gif $DIGIT_DIR/F/strip.gif
$INSTALL_PROG -c $DigitE/0.gif $DIGIT_DIR/F/0.gif
$INSTALL_PROG -c $DigitE/1.gif $DIGIT_DIR/F/1.gif
$INSTALL_PROG -c $DigitE/2.gif $DIGIT_DIR/F/2.gif
$INSTALL_PROG -c $DigitE/3.gif $DIGIT_DIR/F/3.gif
$INSTALL_PROG -c $DigitE/4.gif $DIGIT_DIR/F/4.gif
$INSTALL_PROG -c $DigitE/5.gif $DIGIT_DIR/F/5.gif
$INSTALL_PROG -c $DigitE/6.gif $DIGIT_DIR/F/6.gif
$INSTALL_PROG -c $DigitE/7.gif $DIGIT_DIR/F/7.gif
$INSTALL_PROG -c $DigitE/8.gif $DIGIT_DIR/F/8.gif
$INSTALL_PROG -c $DigitE/9.gif $DIGIT_DIR/F/9.gif
$INSTALL_PROG -c $DigitE/10.gif $DIGIT_DIR/F/10.gif
$INSTALL_PROG -c $DigitE/11.gif $DIGIT_DIR/F/11.gif
$INSTALL_PROG -c $DigitE/12.gif $DIGIT_DIR/F/12.gif
$INSTALL_PROG -c $DigitE/13.gif $DIGIT_DIR/F/13.gif
$INSTALL_PROG -c $DigitE/14.gif $DIGIT_DIR/F/14.gif
;;
*)
esac